/*
 * @Description: 
 * @Version: 1.0
 * @Autor: laikt
 * @Date: 2021-01-11 14:15:01
 * @LastEditors: laikt
 * @LastEditTime: 2021-01-11 16:36:56
 */
// src/logical/user/user.dto.ts
import { IsArray, IsNotEmpty, IsNumber, IsString } from 'class-validator'
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'

export class TableDTO {
    @ApiProperty()
    @IsNotEmpty({ message: 'code不能为空' })
    @IsString({ message: 'code String 类型' })
    readonly code: string

    @ApiProperty()
    @IsNotEmpty({ message: 'tableColumn不能为空' })
    @IsArray({ message: 'tableColumn 数组' })
    readonly tableColumn:TableColumnDTO[]
    
}
export class TableColumnDTO {
    @ApiProperty({ description: '字段名', example: 'name' })
    @IsNotEmpty({ message: '字段名不能为空' })
    readonly prop: string

    @ApiProperty({ description: '标题', example: '123' })
    @IsNotEmpty({ message: '标题不能为空' })
    readonly label: string

    @ApiProperty({ description: '宽度', example: '100px' })
    readonly width: string

    @ApiProperty({ description: '最小宽度号', example: '100px' })
    readonly minWidth: string

    @ApiProperty({ description: '对齐方式', example: 'center' })
    @ApiPropertyOptional({
        description:
            '默认：center ； 参数 left,center,right'
    })
    readonly fixed: string
    
    @ApiProperty({ description: '列的className', example: 'className' })
    readonly className: string

    @ApiProperty({ description: '当前列标题的自定义类名', example: 'className' })
    readonly labelClassName: string

    @ApiProperty({ description: '是否显示', example: 'true/false' })
    readonly show: boolean

    @ApiProperty({ description: '是否显示', example: 'true/false' })
    readonly resizable: boolean

}

export class TableCodeDTO {
    @ApiProperty({ description: 'code', example: 'manger:user' })
    @IsNotEmpty({ message: 'code不能为空' })
    readonly code: string
}
